<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改审核配置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-config-edit" th:object="${etlCheckConfig}">
            <input name="idConfig" th:field="*{idConfig}" type="hidden">
            <input name="idConfig" th:field="*{idDrawDm}" type="hidden">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">指标：</label>
                        <div class="col-sm-8">
                            <input name="naIndex" th:field="*{naIndex}" class="form-control" disabled type="text">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">修改标志：</label>
                        <div class="col-sm-8">
                            <select name="fgModi" class="form-control m-b">
                                <option value=1 th:field="*{fgModi}" th:selected="*{fgModi} eq 1 ">可修改</option>
                                <option value=0 th:field="*{fgModi}" th:selected="*{fgModi} eq 0 ">不可修改</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">dm表：</label>
                        <div class="col-sm-8">
                            <input name="tbDm" th:field="*{tbDm}" class="form-control" disabled type="text">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">app表：</label>
                        <div class="col-sm-8">
                            <input name="tbApp" th:field="*{tbApp}" class="form-control" disabled type="text">
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <h4 class="form-header h4" onclick="choseFld()" style="cursor:pointer ">字段选择 <i class="glyphicon glyphicon-plus"></i></h4>
        <div class="row">
            <table class="table table-bordered" style="width: 70%;margin: 0 auto">
                <colgroup>
                    <col width="40%">
                    <col width="40%">
                    <col width="20%">
                </colgroup>
                <thead>
                <tr>
                    <th>编码</th>
                    <th>名称</th>
                    <th></th>
                </tr>
                </thead>
                <tbody id="fildLIst" >
                <tr th:each="item:${fldList}">
                    <td th:text="${item.idPubfld}"></td>
                    <td th:text="${item.naPubfld}"></td>
                    <td><a class="btn btn-danger btn-xs " href="javascript:void(0)" th:onclick="deleteFld([[${item.idPubfld}]])"><i class="fa fa-edit"></i>删除</a></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "etl/check/config";
        $("#form-config-edit").validate({
            focusCleanup: true
        });

        function choseFld(){
            var options = {
                title:"添加["+$("#naIndex").val()+"]维度字段",
                width: "500",
                height: "600",
                url: prefix+"/toAddFld/"+$("#idConfig").val(),
                callBack: reloadFld
            };
            $.modal.openOptions(options);
        }

        function reloadFld(index, layero) {
            var iframeWin = layero.find('iframe')[0];
            iframeWin.contentWindow.submitHandler(index, layero);
            location.reload();
        }

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
            }
        }
    </script>
</body>
</html>